Conversation
Co-authored-by: oyve <16225018+oyve@users.noreply.github.com>
… temperature Co-authored-by: oyve <16225018+oyve@users.noreply.github.com>
Co-authored-by: oyve <16225018+oyve@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Research improvements for altitudeFromPressureDifference method
Add moist air support to altitudeFromPressureDifference using virtual temperature
Dec 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The hypsometric formula for altitude calculation uses the specific gas constant for dry air (287.05 J/(kg·K)), which underestimates altitude in humid conditions. Moist air is less dense than dry air at the same T and P because water vapor (~18 g/mol) is lighter than dry air (~29 g/mol).
Added optional
relativeHumidityparameter that applies virtual temperature correction when provided.Type of Change
Related Issue
Fixes #(research-altitude-from-pressure-difference)
Changes Made
relativeHumidityparameter (0-100%) toaltitudeFromPressureDifferencesaturationVaporPressure,actualVaporPressure,mixingRatio,virtualTemperature)Formula Details (if applicable)
Formula Name
Hypsometric Equation with Virtual Temperature Correction
Scientific Source
Input Parameters
referencePressure- Reference pressure (Pa)observedPressure- Observed pressure (Pa)referenceAltitude- Reference altitude (m), default 0temperature- Average temperature (K), default 288.15relativeHumidity- Optional relative humidity (%), 0-100Output
Validation
Testing
Test Coverage
npm test)npm run build)Test Results
Manual Testing
Documentation
Checklist
Breaking Changes
Details of breaking changes:
N/A - fully backward compatible. Omitting
relativeHumidityproduces identical results.Screenshots (if applicable)
N/A
Additional Notes
virtualTemperature()from temperature.tsPerformance Impact
Details:
Additional calculations only when
relativeHumidityis provided.Dependencies
Reviewer Notes
src/formulas/altitude.tsOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.